package org.example.Day3;

import java.io.IOException;
import java.io.InterruptedIOException;

public class RuntimeTest {
    //用于获取jvm的一些信息
    public static void main(String[] args) throws IOException, InterruptedException {
        Runtime r = Runtime.getRuntime();
        //获取虚拟机能用处理器数
        System.out.println(r.availableProcessors());
        //返回JAVA虚拟机内存总量
        System.out.println(r.totalMemory()/1024.0/1024.0+"MB");
        //1024 = 1K  1024*1024=1M
        //返回java虚拟机中可用内存量
        System.out.println(r.freeMemory()/1024.0/1024.0+"MB");

        Process p = r.exec("QQ");
        Thread.sleep(5000);
        p.destroy();

    }
}
